package com.mzx.javase.io;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;

/**
 * 类描述：Properties类的使用
 *
 * @ClassName PropertiesTest
 * @Description TODO
 * @Author 马子鑫
 * @Date 2022/8/1 10:06
 * @Version 1.0
 */
public class PropertiesTest {
    public static void main(String[] args) {
        Properties properties = new Properties();
        try {
            properties.load(new FileInputStream("db.properties"));
            Set<String> propertyNames = properties.stringPropertyNames();
            for (String name : propertyNames) {
                System.out.println("key="+name + ";value=" + properties.getProperty(name));
            }

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
